package com.study.modules.designPatterns.No3FactoryMode;

/**
 * 工厂模式
 */
public class ProductFactory {

    /**
     * 获取产品
     *
     * @param productType 产品类型
     * @return 产品
     */
    public static Product getProduct(String productType) {
        Product product = null;
        switch (productType) {
            case "computer":
                product = new ComputerProduct();
                break;
            case "mobile":
                product = new MobileProduct();
                break;
            case "earphone":
                product = new EarphoneProduct();
                break;
        }
        return product;
    }

}
